import Mock from 'mockjs'

const datas = []
const count = 1000
const header = [
  {
    text: '作者',
    key: 'author'
  },
  {
    text: '标题',
    key: 'title'
  },
  {
    text: '内容',
    key: 'content'
  },
  {
    text: '重要程度',
    key: 'importance'
  }
]
const baseContent = '我是测试数据我是测试数据'

for (let i = 0; i < count; i++) {
  datas.push(Mock.mock({
    id: '@increment',
    timestamp: +Mock.Random.date('T'),
    author: '@first',
    reviewer: '@first',
    title: '@title(5, 10)',
    content_short: '我是测试数据',
    content: baseContent,
    forecast: '@float(0, 100, 2, 2)',
    importance: '@integer(1, 3)',
    'type|1': ['CN', 'US', 'JP', 'EU'],
    'status|1': ['published', 'draft', 'deleted'],
    display_time: '@datetime',
    comment_disabled: true,
    pageviews: '@integer(300, 5000)',
    platforms: ['a-platform']
  }))
}
const table = {
  header: header,
  datas: datas
}
export default {
  get: config => {
    return {
      table: table
    }
  }
}
